<template>
	<view>
		
		<view class="RecordList" v-for="(item,index) in ListInfo" :key="index">
			<view class="FleBox orderinfo">
				<view class="">
					订单编号：{{item.point_ordersn}}
				</view>
				<view v-if="item.point_orderstate==2"  style="color: #666666;">已取消</view>
				<view v-if="item.point_orderstate==20" style="color: #ff4300;">待发货</view>
				<view v-if="item.point_orderstate==30" style="color: #ff7800;">已发货</view>
				<view v-if="item.point_orderstate==40" style="color: #ae900a;">已收货</view>
				<view v-if="item.point_orderstate==50" style="color: #44bb00;">已完成</view>
			</view>
			<view class="FleBox CommInfo" v-for="(item2,index2) in item.prodlist" :key="index2">
				<view class="ImgBox">
					<image :src="item2.point_goodsimage" mode=""></image>
				</view>
				<view class="">
					<view class="Name">
						{{item2.point_goodsname}}
					</view>
					<view class="">
						<view class="Num">
							数量：1
						</view>
						<view class="Price">
							积分：{{item2.point_goodspoints}}
						</view>
						<view class="Time">
							兑换时间：{{item.point_addtime |formaDate}}
						</view>
					</view>
				</view>

			</view>
			<view class="operation" v-if="item.point_orderstate==30">
				<text class="confirm" @click="query(item.point_orderid)">查看物流</text>
				<text class="confirm" @click="confirm(item.point_orderid)">确认收货</text>
			</view>
		</view>
		
		<view class="IFnull" v-if="ListInfo.length==0">
			暂无记录
		</view>
	</view>
</template>

<script >
	export default {
		data() {
			return {
				ListInfo:'',
			}
		},
		created() {
			this.GetList();
		},
		methods: {
			GetList(){
				this.$util.request({
					url:'/mobile/index.php?act=member_pointorder&op=orderlist',
					data:{}
				}).then(res=>{
					if(res.error_code==0){
						this.ListInfo=res.datas.list
					}else{
						uni.showToast({
							title:res.message,
							icon:"none"
						})
					}
				})
			},
			query(e){
				uni.navigateTo({
					url:'/plug/logistics/info?order_jifen_id='+e+"&type=jifen"
				})
			},
			confirm(order_id){
			
					this.$util.request({
						url:'/mobile/index.php?act=member_pointorder&op=receiving_order',
						data:{order_id}
					}).then(res=>{
						if(res.error_code==0){
							uni.showToast({
								title:"收货成功",
								icon:"none"
							})
							this.GetList();
						}else{
							uni.showToast({
								title:res.message,
								icon:"none"
							})
						}
					})
			},
		}
	}
</script>

<style scoped="scoped">
	.IFnull{
		font-size: 30rpx;
		text-align: center;
		/* margin: 30rpx 0; */
		font-weight: bold;
	}
	.operation{
		border-top: 1rpx solid #EEEEEE;
		display: flex;
		justify-content: flex-end;
	}
	.operation .confirm{
		padding:0 10rpx;
		background-color: #ff4300;
		color: #FFFFFF;
		border-radius: 10rpx;
		font-size: 26rpx;
		margin: 15rpx;
	}
	.FleBox{
		display: flex;
		justify-content: space-between;
		align-items: center;
	}
	.RecordList{
		background-color: #FFFFFF;
		margin: 20rpx 30rpx;
		border-radius: 20rpx;
	}
	.orderinfo{
		padding: 10rpx 20rpx;
		border-bottom: 1rpx solid #EEEEEE;
	}
	.CommInfo{
		padding:20rpx;
	}
	.CommInfo .Name{
		font-size: 28rpx;
		color: #333333;
		line-height: 35rpx;
		height: 70rpx;
		font-weight: bold;
		display: -webkit-box;
		-webkit-box-orient:vertical;
		-webkit-line-clamp:2;
		overflow: hidden;
		margin-bottom: 15rpx;
	}
	.CommInfo .Num,.CommInfo .Price,.CommInfo .Time{
		line-height: 40rpx;
		color: #999999;
	}
	.ImgBox image{
		width: 210rpx;
		height: 210rpx;
		border-radius: 15rpx;
		margin-right: 20rpx;
	}
	.c44bb00{
		color: #44bb00;
	}
</style>
